package com.wenhui.schoolyardinfo.square.ui;

import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.OrientationHelper;
import android.support.v7.widget.RecyclerView;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;

import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
import com.bigkoo.pickerview.builder.TimePickerBuilder;
import com.bigkoo.pickerview.listener.OnOptionsSelectChangeListener;
import com.bigkoo.pickerview.listener.OnOptionsSelectListener;
import com.bigkoo.pickerview.listener.OnTimeSelectListener;
import com.bigkoo.pickerview.view.OptionsPickerView;
import com.bigkoo.pickerview.view.TimePickerView;
import com.qmuiteam.qmui.widget.QMUITopBar;
import com.wenhui.schoolyardinfo.R;
import com.wenhui.schoolyardinfo.base.BaseActivity;
import com.wenhui.schoolyardinfo.callback.RcvOnItemViewClickListener;
import com.wenhui.schoolyardinfo.customview.CommonPopupWindow;
import com.wenhui.schoolyardinfo.customview.RecyclerViewDivider;
import com.wenhui.schoolyardinfo.firstpage.adapter.BaseRecyclerAdapter;
import com.wenhui.schoolyardinfo.firstpage.holder.SmartViewContentHolder;
import com.wenhui.schoolyardinfo.firstpage.ui.SearchActivity;
import com.wenhui.schoolyardinfo.manager.DateManager;
import com.wenhui.schoolyardinfo.manager.PopupWindowManager;
import com.wenhui.schoolyardinfo.manager.ScreenManager;
import com.wenhui.schoolyardinfo.release.adapter.SelectPhotosAdapter;
import com.wenhui.schoolyardinfo.square.adapter.PublicGoodAdapter;
import com.wenhui.schoolyardinfo.square.bean.ProvinceBean;
import com.wenhui.schoolyardinfo.square.bean.PublicGoodBean;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * author    : Urasaki
 * e-mail    : 1164688204@qq.com
 * date      : 2019/7/4 9:20
 * introduce : 公益activity
 */

public class PublicGoodActivity extends BaseActivity implements RcvOnItemViewClickListener {

    private static final String TAG = "PublicGoodActivity";
    @BindView(R.id.imv_back)
    ImageView imvBack;
    @BindView(R.id.layout_back)
    RelativeLayout layoutBack;
    @BindView(R.id.imv_search)
    ImageView imvSearch;
    @BindView(R.id.layout_search)
    RelativeLayout layoutSearch;
    @BindView(R.id.imv_more)
    ImageView imvMore;
    @BindView(R.id.layout_more)
    RelativeLayout layoutMore;
    @BindView(R.id.topbar)
    QMUITopBar topbar;
    @BindView(R.id.mine_recycler_view)
    RecyclerView mineRecyclerView;
    @BindView(R.id.view_bottom)
    View viewBottom;

    private List<String> pictureList;
    private List<PublicGoodBean> publicGoodBeanList;
    private PublicGoodAdapter publicGoodAdapter;
    private LinearLayoutManager layoutManager;

    //Popwindow
    private CommonPopupWindow window;
    private RecyclerView moreRecyclerView;
    private RelativeLayout layoutAngleLabelTop;
    private RelativeLayout layoutAngleLabelBottom;
    private BaseRecyclerAdapter<String> baseRecyclerAdapter;
    private List<String> stringList;

    //Popwindow
    private CommonPopupWindow statusWindow;
    private RecyclerView selectPhotosRecyclerView;
    private SelectPhotosAdapter selectPhotosAdapter;
    private List<String> stringStatusList;

    private Calendar selectedDate;
    private Calendar startDate;
    private Calendar endDate;
    //时间选择器
    private TimePickerView timePickerView;
    //条件选择器（地区）
    private OptionsPickerView optionsPickerView;
    private ArrayList<ProvinceBean> options1Items;
    private ArrayList<ArrayList<String>> options2Items;
    private String time;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_public_good);
        ButterKnife.bind(this);


        initData();
        initViews();
    }

    @Override
    protected void initData() {
        pictureList = new ArrayList<>();
        publicGoodBeanList = new ArrayList<>();
        pictureList.add("http://ww1.sinaimg.cn/large/0065oQSqly1fsfq1k9cb5j30sg0y7q61.jpg");
        pictureList.add("http://ww1.sinaimg.cn/large/0065oQSqly1frv032vod8j30k80q6gsz.jpg");
        pictureList.add("http://ww1.sinaimg.cn/large/0065oQSqly1fsfq1k9cb5j30sg0y7q61.jpg");
        publicGoodBeanList.add(new PublicGoodBean("http://ww1.sinaimg.cn/large/0065oQSqly1frv032vod8j30k80q6gsz.jpg",
                "救助站公益活动", "发起人：隆美尔",
                7210000101010L, 10000010101010L));
        publicGoodBeanList.add(new PublicGoodBean("http://ww1.sinaimg.cn/large/0065oQSqly1fsfq1k9cb5j30sg0y7q61.jpg",
                "救助站公益活动", "发起人：隆美尔",
                7210000101010L, 10000010101010L));
        publicGoodBeanList.add(new PublicGoodBean("http://ww1.sinaimg.cn/large/0065oQSqly1fsfq1k9cb5j30sg0y7q61.jpg",
                "救助站公益活动", "发起人：隆美尔",
                9210000101010L, 10000010101010L));
        publicGoodBeanList.add(new PublicGoodBean("http://ww1.sinaimg.cn/large/0065oQSqly1frv032vod8j30k80q6gsz.jpg",
                "救助站公益活动", "发起人：隆美尔",
                9210000101010L, 10000010101010L));
        publicGoodBeanList.add(new PublicGoodBean("http://ww1.sinaimg.cn/large/0065oQSqly1fsfq1k9cb5j30sg0y7q61.jpg",
                "救助站公益活动", "发起人：隆美尔",
                9210000101010L, 10000010101010L));
        publicGoodBeanList.add(new PublicGoodBean("http://ww1.sinaimg.cn/large/0065oQSqly1frv032vod8j30k80q6gsz.jpg",
                "救助站公益活动", "发起人：隆美尔",
                9210000101010L, 10000010101010L));
        publicGoodBeanList.add(new PublicGoodBean("http://ww1.sinaimg.cn/large/0065oQSqly1fsfq1k9cb5j30sg0y7q61.jpg",
                "救助站公益活动", "发起人：隆美尔",
                7210000101010L, 10000010101010L));
        publicGoodBeanList.add(new PublicGoodBean("http://ww1.sinaimg.cn/large/0065oQSqly1frv032vod8j30k80q6gsz.jpg",
                "救助站公益活动", "发起人：隆美尔",
                9210000101010L, 10000010101010L));
        publicGoodBeanList.add(new PublicGoodBean("http://ww1.sinaimg.cn/large/0065oQSqly1fsfq1k9cb5j30sg0y7q61.jpg",
                "救助站公益活动", "发起人：隆美尔",
                9210000101010L, 10000010101010L));
        publicGoodBeanList.add(new PublicGoodBean("http://ww1.sinaimg.cn/large/0065oQSqly1frv032vod8j30k80q6gsz.jpg",
                "救助站公益活动", "发起人：隆美尔",
                9210000101010L, 10000010101010L));
        publicGoodBeanList.add(new PublicGoodBean("http://ww1.sinaimg.cn/large/0065oQSqly1fsfq1k9cb5j30sg0y7q61.jpg",
                "救助站公益活动", "发起人：隆美尔",
                9210000101010L, 10000010101010L));
        publicGoodBeanList.add(new PublicGoodBean("http://ww1.sinaimg.cn/large/0065oQSqly1frv032vod8j30k80q6gsz.jpg",
                "救助站公益活动", "发起人：隆美尔",
                7210000101010L, 10000010101010L));


        stringList = new ArrayList<>();
        stringList.add("我参加的公益");
        stringList.add("我发布的公益");
        stringList.add("发布公益");

        stringStatusList = new ArrayList<>();
        stringStatusList.add("正在进行的活动");
        stringStatusList.add("即将开始的活动");
        stringStatusList.add("我已加入的活动");
        stringStatusList.add("取消");

        startDate = Calendar.getInstance();
        endDate = Calendar.getInstance();
        selectedDate = Calendar.getInstance();
        //正确设置方式 原因：注意事项有说明
        startDate.set(1919, 0, 1);

        options1Items = new ArrayList<>();
        options2Items = new ArrayList<>();
        initOptionData();
    }

    @Override
    protected void initViews() {
        setTopBar(topbar);

        initAdapter();
        initPopupWindow();
        initTimePicker();
        initOptionPicker();
    }

    private void initOptionData() {

        /**
         * 注意：如果是添加JavaBean实体数据，则实体类需要实现 IPickerViewData 接口，
         * PickerView会通过getPickerViewText方法获取字符串显示出来。
         */
        //选项1
        options1Items.add(new ProvinceBean(0, "广东", "描述部分", "其他数据"));
        options1Items.add(new ProvinceBean(1, "湖南", "描述部分", "其他数据"));
        options1Items.add(new ProvinceBean(2, "广西", "描述部分", "其他数据"));

        //选项2
        ArrayList<String> options2Items_01 = new ArrayList<>();
        options2Items_01.add("广州");
        options2Items_01.add("佛山");
        options2Items_01.add("东莞");
        options2Items_01.add("珠海");
        ArrayList<String> options2Items_02 = new ArrayList<>();
        options2Items_02.add("长沙");
        options2Items_02.add("岳阳");
        options2Items_02.add("株洲");
        options2Items_02.add("衡阳");
        ArrayList<String> options2Items_03 = new ArrayList<>();
        options2Items_03.add("桂林");
        options2Items_03.add("玉林");
        options2Items.add(options2Items_01);
        options2Items.add(options2Items_02);
        options2Items.add(options2Items_03);

        /*--------数据源添加完毕---------*/
    }

    private void initAdapter() {
        layoutManager = new LinearLayoutManager(this);
        layoutManager.setOrientation(OrientationHelper.VERTICAL);
        mineRecyclerView.setLayoutManager(layoutManager);
        mineRecyclerView.setItemAnimator(new DefaultItemAnimator());

        publicGoodAdapter = new PublicGoodAdapter(this);
        mineRecyclerView.setAdapter(publicGoodAdapter);
        publicGoodAdapter.setRcvOnItemViewClickListener(this);
        publicGoodAdapter.clearData();
        publicGoodAdapter.addAllData(pictureList, publicGoodBeanList);
    }

    private void initPopupWindow() {
        // create popup window
        window = new CommonPopupWindow(this, R.layout.popup_window_public_good, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) {
            @Override
            protected void initViews() {
                View view = getContentView();
                layoutManager = new LinearLayoutManager(PublicGoodActivity.this);
                layoutManager.setOrientation(OrientationHelper.VERTICAL);

                moreRecyclerView = view.findViewById(R.id.more_recycler_view);
                layoutAngleLabelTop = view.findViewById(R.id.layout_angle_label_top);
                layoutAngleLabelBottom = view.findViewById(R.id.layout_angle_label_bottom);
                moreRecyclerView.setItemAnimator(new DefaultItemAnimator());
                moreRecyclerView.setLayoutManager(layoutManager);
                moreRecyclerView.addItemDecoration(new RecyclerViewDivider(
                        PublicGoodActivity.this,
                        LinearLayoutManager.VERTICAL,
                        ScreenManager.dipTopx(PublicGoodActivity.this, 1),
                        getResources().getColor(R.color.colorGrayB)));
                baseRecyclerAdapter = new BaseRecyclerAdapter<String>(R.layout.item_popup_window_recommend, 1) {
                    @Override
                    protected void onBindViewHolder(RecyclerView.ViewHolder holder, String model, int position) {
                        if (holder instanceof SmartViewContentHolder) {
                            SmartViewContentHolder smartViewContentHolder = (SmartViewContentHolder) holder;
                            smartViewContentHolder.text(R.id.tev_concern, model);

                            View viewConcern = smartViewContentHolder.getView(R.id.view_concern);
                            if (position == stringList.size() - 1) {
                                viewConcern.setVisibility(View.GONE);
                            }
                        }
                    }
                };

                moreRecyclerView.setAdapter(baseRecyclerAdapter);

                baseRecyclerAdapter.clearData();
                baseRecyclerAdapter.addAllData(stringList);
            }

            @Override
            protected void initEvent() {
                baseRecyclerAdapter.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                    @Override
                    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                        switch (position) {
                            case 0:
//                                showToast("点击了concern");
                                startActivity(MineJoinPublicGoodActivity.class);
                                break;
                            case 1:
                                showToast("点击了privateLetter");
                                break;
                            case 2:
                                showToast("点击了collect");
                                break;
                            case 3:
                                showToast("点击了report");
                                break;
                        }
                        window.getPopupWindow().dismiss();
                    }
                });
            }

            @Override
            protected void initWindow() {
                super.initWindow();
                PopupWindow instance = getPopupWindow();
                instance.setOnDismissListener(new PopupWindow.OnDismissListener() {
                    @Override
                    public void onDismiss() {
                        WindowManager.LayoutParams lp = getWindow().getAttributes();
                        lp.alpha = 1.0f;
                        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
                        getWindow().setAttributes(lp);
                    }
                });
            }
        };


        // create popup window
        statusWindow = new CommonPopupWindow(this, R.layout.popup_window_release, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) {
            @Override
            protected void initViews() {
                View view = getContentView();
                selectPhotosRecyclerView = view.findViewById(R.id.select_photos_recycler_view);
                layoutManager = new LinearLayoutManager(PublicGoodActivity.this);
                layoutManager.setOrientation(OrientationHelper.VERTICAL);
                selectPhotosRecyclerView.setLayoutManager(layoutManager);
                selectPhotosRecyclerView.setItemAnimator(new DefaultItemAnimator());

                selectPhotosAdapter = new SelectPhotosAdapter(PublicGoodActivity.this);
                selectPhotosRecyclerView.setAdapter(selectPhotosAdapter);
                selectPhotosAdapter.clearData();
                selectPhotosAdapter.addAllData(stringStatusList);
            }

            @Override
            protected void initEvent() {
                selectPhotosAdapter.setRcvOnItemViewClickListener(new RcvOnItemViewClickListener() {
                    @Override
                    public void onItemClickListener(int position, View view) {
                        switch (position) {
                            case 0:
                                showToast("selection_from_mobile_phone_album");

                                break;
                            case 1:
                                showToast("make_small_videos");
                                break;
                            case 2:
                                showToast("shoot");

                                break;
                            case 3:
                                showToast("cancel");
                                break;
                            default:
                                break;
                        }
                        statusWindow.getPopupWindow().dismiss();
                    }
                });
            }

            @Override
            protected void initWindow() {
                super.initWindow();
                PopupWindow instance = getPopupWindow();
                instance.setOnDismissListener(new PopupWindow.OnDismissListener() {
                    @Override
                    public void onDismiss() {
                        WindowManager.LayoutParams lp = getWindow().getAttributes();
                        lp.alpha = 1.0f;
                        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
                        getWindow().setAttributes(lp);
                    }
                });
            }
        };
    }

    private void showPopupWindow(View anchorView) {
//        View contentView = CommonPopupWindow();
//        mPopupWindow = new PopupWindow(contentView,
//                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true);
        // 如果不设置PopupWindow的背景，有些版本就会出现一个问题：无论是点击外部区域还是Back键都无法dismiss弹框
//        mPopupWindow.setBackgroundDrawable(new ColorDrawable());
//        // 设置好参数之后再show
//        int windowPos[] = PopupWindowManager.calculatePopWindowPos(anchorView, contentView);
//        int xOff = 20; // 可以自己调整偏移
//        windowPos[0] -= xOff;
//        mPopupWindow.showAtLocation(anchorView, Gravity.TOP | Gravity.START, windowPos[0], windowPos[1]);

        PopupWindow mPopupWindow = window.getPopupWindow();
        mPopupWindow.setAnimationStyle(R.style.animTranslate);
        mPopupWindow.setBackgroundDrawable(new ColorDrawable());
        // 设置点击窗口外边窗口消失
        mPopupWindow.setOutsideTouchable(true);
        // 设置此参数获得焦点，否则无法点击
        mPopupWindow.setFocusable(true);
        // 设置好参数之后再show
        int windowPos[] = PopupWindowManager.calculatePopWindowPos(anchorView, window.getContentView());
        int xOff = 20; // 可以自己调整偏移
        windowPos[0] -= xOff;

        //是否需要向上弹出/向下弹出显示
        boolean isNeedShowUp = PopupWindowManager.isNeedShowUp(anchorView, window.getContentView());
        if (isNeedShowUp) {
            layoutAngleLabelTop.setVisibility(View.GONE);
            layoutAngleLabelBottom.setVisibility(View.VISIBLE);
        } else {
            layoutAngleLabelTop.setVisibility(View.VISIBLE);
            layoutAngleLabelBottom.setVisibility(View.GONE);
        }
        // 设置popupWindow的显示位置
        mPopupWindow.showAtLocation(anchorView, Gravity.TOP | Gravity.START, windowPos[0], windowPos[1]);

        WindowManager.LayoutParams lp = getWindow().getAttributes();
        lp.alpha = 0.3f;
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
        getWindow().setAttributes(lp);
    }

    private void showStatusPopupWindow(View anchorView) {
        PopupWindow mPopupWindow = statusWindow.getPopupWindow();
        mPopupWindow.setAnimationStyle(R.style.PopupWindowTranslucentTheme);
        // 如果不设置PopupWindow的背景，有些版本就会出现一个问题：无论是点击外部区域还是Back键都无法dismiss弹框
        mPopupWindow.setBackgroundDrawable(getResources().getDrawable(R.drawable.bg_corners_2_blue_a));
        // 设置点击窗口外边窗口消失
        mPopupWindow.setOutsideTouchable(true);
        // 设置此参数获得焦点，否则无法点击
        mPopupWindow.setFocusable(true);

        // 设置popupWindow的显示位置，此处是在手机屏幕底部且水平居中的位置
        mPopupWindow.showAtLocation(anchorView, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);
//        mPopupWindow.showAtLocation(anchorView, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 10);

        WindowManager.LayoutParams lp = getWindow().getAttributes();
        lp.alpha = 0.5f;
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
        getWindow().setAttributes(lp);
    }

    private void initTimePicker() {
        timePickerView = new TimePickerBuilder(this, new OnTimeSelectListener() {
            @Override
            public void onTimeSelect(Date date, View v) {//选中事件回调
                time = DateManager.getTime(date);

            }
        })
                .setType(new boolean[]{true, true, true, false, false, false})// 默认全部显示
//                .setTitleSize(20)//标题文字大小
//                .setTitleText("时间选择")//标题文字
                .setCancelText(getResources().getString(R.string.cancel))//取消按钮文字
                .setSubmitText(getResources().getString(R.string.determine))//确定按钮文字
                .setContentTextSize(16)//设置滚轮文字大小
                .setOutSideCancelable(true)//点击屏幕，点在控件外部范围时，是否取消显示
                .isCyclic(true)//是否循环滚动
                .setTitleColor(Color.BLACK)//标题文字颜色
                .setSubmitColor(getResources().getColor(R.color.colorBlueA))//确定按钮文字颜色
                .setCancelColor(Color.BLACK)//取消按钮文字颜色
                .setTitleBgColor(getResources().getColor(R.color.colorWhiteA))//标题背景颜色 Night mode
                .setBgColor(getResources().getColor(R.color.colorWhiteA))//滚轮背景颜色 Night mode
                .setLineSpacingMultiplier(2.4f)//设置子项之间的间距
                .setDate(selectedDate)// 如果不设置的话，默认是系统时间*/
                .setRangDate(startDate, endDate)//起始终止年月日设定
                .setLabel("年", "月", "日", "时", "分", "秒")//默认设置为年月日时分秒
                .isCenterLabel(false) //是否只显示中间选中项的label文字，false则每项item全部都带有label。
                .isDialog(false)//是否显示为对话框样式
                .build();
    }

    private void initOptionPicker() {//条件选择器初始化
        /**
         * 注意 ：如果是三级联动的数据(省市区等)，请参照 JsonDataActivity 类里面的写法。
         */
        optionsPickerView = new OptionsPickerBuilder(this, new OnOptionsSelectListener() {
            @Override
            public void onOptionsSelect(int options1, int options2, int options3, View v) {
                //返回的分别是三个级别的选中位置
                String tx = options1Items.get(options1).getPickerViewText()
                        + options2Items.get(options1).get(options2)
                       /* + options3Items.get(options1).get(options2).get(options3).getPickerViewText()*/;

            }
        })
//                .setTitleText("城市选择")
//                .setTitleSize(20)//标题文字大小
                .setCancelText(getResources().getString(R.string.cancel))//取消按钮文字
                .setSubmitText(getResources().getString(R.string.determine))//确定按钮文字
                .setContentTextSize(16)//设置滚轮文字大小
                .setOutSideCancelable(true)//点击屏幕，点在控件外部范围时，是否取消显示
                .setDividerColor(Color.LTGRAY)//设置分割线的颜色
                .setSelectOptions(0, 0)//默认选中项
                .setBgColor(getResources().getColor(R.color.colorWhiteA))
                .setTitleBgColor(getResources().getColor(R.color.colorWhiteA))
//                .setTitleColor(Color.LTGRAY)
                .setCancelColor(getResources().getColor(R.color.colorBlackA))
                .setSubmitColor(getResources().getColor(R.color.colorBlueA))
                .setTextColorCenter(getResources().getColor(R.color.colorBlackA))
                .setLineSpacingMultiplier(2.4f)//设置子项之间的间距
                .isRestoreItem(true)//切换时是否还原，设置默认选中第一项。
                .isCenterLabel(false) //是否只显示中间选中项的label文字，false则每项item全部都带有label。
                .setLabels("省", "市", "区")
//                .setBackgroundId(0x00000000) //设置外部遮罩颜色
                .setOptionsSelectChangeListener(new OnOptionsSelectChangeListener() {
                    @Override
                    public void onOptionsSelectChanged(int options1, int options2, int options3) {
                        String str = "options1: " + options1 + "\noptions2: " + options2 + "\noptions3: " + options3;


                    }
                })
                .build();

        optionsPickerView.setPicker(options1Items, options2Items);//二级选择器
    }

    @Override
    public void onItemClickListener(int position, View view) {
        switch (view.getId()) {
            case R.id.banner:
                showToast("banner");
                break;
            case R.id.layout_region:
                showToast("layout_region");
                optionsPickerView.show(view);
                break;
            case R.id.layout_time:
                showToast("layout_time");
                timePickerView.show(view);//弹出时间选择器，传递参数过去，回调的时候则可以绑定此view
                break;
            case R.id.layout_state:
                showToast("layout_state");
                showStatusPopupWindow(viewBottom);
                break;
            case R.id.layout_public_good:
                showToast("layout_public_good");
                break;
            default:
                break;
        }
    }

    @OnClick({R.id.layout_back, R.id.layout_search, R.id.layout_more})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.layout_back:
                finish();
                break;
            case R.id.layout_search:
                startActivity(SearchActivity.class);
                break;
            case R.id.layout_more:
                showPopupWindow(view);
                break;
        }
    }
}
